package cn.moukou.tongji.ihealth.patient.service;

import cn.moukou.tongji.ihealth.patient.dao.CaseRecordMapper;
import cn.moukou.tongji.ihealth.patient.pojo.CaseRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CaseRecordService {

    @Autowired
    CaseRecordMapper caseRecordMapper;

    public List<CaseRecord> getCaseRecordsByPid(String pid ) {
        Map<String, Object> map = new HashMap<>();
        map.put("pid", pid);
        List<CaseRecord> caseRecords =  caseRecordMapper.selectByMap(map);
        for(CaseRecord caseRecord : caseRecords) {
            caseRecord.setIdstr(caseRecord.getId().toString());
        }
        return caseRecords;
    }

    public CaseRecord getOne(Long id) {
        return caseRecordMapper.selectById(id);
    }

}
